home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / PASCAL / 2009.ZIP / STRLINK.ZIP / OBJECTA.DOC next >
Text File  |  1989-08-17  |  3KB  |  93 lines

  1.  
  2.  
  3.  
  4.                              OBJECTA
  5.  
  6.                         A TP 5.5 OOP UNIT
  7.  
  8.             Rob Rosenberger        CIS: 74017,1344
  9.             Barn Owl Software      VOX: (618) 632-7345
  10.             P.O. Box #74           BBS: (618) 398-5703
  11.             O'Fallon, IL  62269    HST: (618) 398-2305
  12.  
  13.      This Turbo Pascal 5.5 unit builds on the OBJECTS.PAS file on
  14. disk three of the TP package.  The Objects unit provides some
  15. excellent linked-list capabilities, but it doesn't allow arbi-
  16. trary placement of a node on the list.  The OBJECTA unit offers a
  17. decendent, LinkList, which provides two methods: LinkList.Before,
  18. to place a node just before some other node in the list, and
  19. LinkList.After, to place a node just after some other node in the
  20. list.
  21.  
  22.      LinkList.Init and LinkList.Done are included because the TP
  23. 5.5 OOP guide recommends these common procedures.  The List
  24. ancestor calls them Clear and Delete, respectively, which I found
  25. extremely odd since Borland is the one calling for a standard set
  26. of method identifiers....
  27.  
  28. Version 1.00: released to the public domain on 8 July 1989.
  29.  
  30. Version 1.01: released to the public domain on 17 August 1989.
  31.      Lavern Ogden discovered an endless loop in the Total()
  32. function.  This was due to my using LinkList.Next instead of
  33. LinkList.Next().  I fault Borland for this error -- there are two
  34. "Next" possibilities.  Shame shame!
  35.      Added a new function, Specific(), which returns a NodePtr to
  36. the nth node in the list.  This will be very handy for people who
  37. use TurboPower Software's TPPICK unit from their TPRO5 toolkit.
  38.  
  39.  
  40. TYPE
  41.    LinkList
  42.     = OBJECT(List)
  43.       PROCEDURE Init;
  44.       PROCEDURE Done;
  45.  
  46.       PROCEDURE Before(TheNode    : NodePtr;
  47.                        BeforeNode : NodePtr);
  48.       PROCEDURE After (TheNode   : NodePtr;
  49.                        AfterNode : NodePtr);
  50.  
  51.       FUNCTION  Specific(NodePos : LONGINT) : NodePtr;
  52.       FUNCTION  Total(TheNode : NodePtr) : LONGINT;
  53.       END;
  54.  
  55.  
  56.  
  57. PROCEDURE LinkList.Init;
  58.  
  59.      This procedure initializes the LinkList.
  60.  
  61.  
  62. PROCEDURE LinkList.Done;
  63.  
  64.      This procedure deletes all nodes from the list.
  65.  
  66.  
  67. PROCEDURE LinkList.Before(TheNode    : NodePtr;
  68.                           BeforeNode : NodePtr);
  69.  
  70.      Places TheNode in the LinkList just before BeforeNode.
  71.  
  72.  
  73. PROCEDURE LinkList.After(TheNode   : NodePtr;
  74.                          AfterNode : NodePtr);
  75.  
  76.      Places TheNode in the LinkList just after AfterNode.
  77.  
  78.  
  79. FUNCTION  LinkList.Specific(NodePos : LONGINT) : NodePtr;
  80.  
  81.      Returns the NodePtr to the nth node in the list, represented
  82. by NodePos.  The returned value will be NIL if NodePos <= 0, or
  83. if it is > Total.
  84.  
  85.  
  86. FUNCTION  LinkList.Total(TheNode : NodePtr) : LONGINT;
  87.  
  88.      This function returns a number corresponding to the number
  89. of nodes on the LinkList.  It starts counting from TheNode^.
  90. Therefore, to get a total count of all nodes on the LinkList, use
  91. LinkListVar.Total(LinkListVar.First).  (Remember, we inherit the
  92. "First" function due to OOP.)
  93.